<template>
    <div  id="<%= chartId %>" style="width: 100%;height:332px;">
        
    </div>
</template>
<script name="compile">
    function templateCompile(data) {
        var defaultData = {
            type: "module",
        };
        var newData = Object.assign(defaultData, data);
        var callback = {
            success: true,
            result: newData
        };
        if(!newData.chartId){
            return {
                success: false,
                result: "图表模板缺少参数：chartId"
            };
        }
        if(!newData.chartOption){
            return {
                success: false,
                result: "图表模板缺少参数：chartOption"
            };
        }
        return callback;
    }
</script>
<script name="templateScript">
    var chartInit<%= chartId %> = echarts.init(document.getElementById('<%= chartId %>'));
    <%- chartOption %>
    chartInit<%= chartId %>.setOption(<%= chartId %>);
</script>